Anillo 3 - Original

An interactive fiction by Mel Hython (2009) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section 4 - 'Libreria' de conversaciones

[--------------------------------------------------

Las que hay en el repositorio no
me acaban de encajar, así que
me meto en el barullo de hacerme
una propia.

--------------------------------------------------]

ConvTabla is a table-name that varies. ConvTabla is Table of NoConv.

Table of NoConv
numero   seleccion   respuesta   activado   activa   extra
a number   a text   a text   a number   a list of numbers   a rule
0   --   "ERROR Conversación"   --   --   --

To decide whether conversacion iniciada:
    if ConvTabla is Table of NoConv:
        decide no;
    otherwise:
        decide yes.

Selecting option is an action applying to one number.
Understand "[number]" as selecting option when conversacion iniciada.

Before doing anything except selecting option or looking when conversacion iniciada:
    say "Mejor no hacer nada hasta que termine esta conversación.";
    stop the action.

Instead of looking when conversacion iniciada:
    try selecting option 0.

Carry out selecting option:
    let N be the number understood;
    if N is 0:
        say "Selecciona una de las opciones indicadas.";
        decir opciones activas en ConvTabla;
        stop the action;
    if there is a activado of N in ConvTabla:
        choose row with activado of N in ConvTabla;
    otherwise:
        if there is a numero of -1 in ConvTabla:
            choose row with numero of -1 in ConvTabla;
            say "[respuesta entry]";
            say line break;
            say line break;
        otherwise:
            say "Selecciona una de las opciones indicadas.";
        decir opciones activas en ConvTabla;
        stop the action;
    say "[seleccion entry]";
    say line break;
    say "[respuesta entry]";
    say line break;
    if numero entry is less than 9000:
        say line break;
        quitar activados ConvTabla;
        nuevas opciones para numero entry en ConvTabla;
    otherwise:
        change ConvTabla to Table of NoConv; [FIN]
    follow extra entry.
    

This is the fake rule:
    rule succeeds.

To quitar activados ( tabla - a table-name ):
    repeat through tabla:
        change activado entry to 0.

To decir opciones activas en ( tabla - a table-name ):
    repeat through tabla:
        if activado entry is not 0:
            say "[activado entry]) [seleccion entry][line break]".

To nuevas opciones para ( num - a number) en ( tabla - a table-name):
    choose row with numero of num in tabla;
    let L be activa entry;
    let N be number of entries of L;
    let C be 0;
    say "Respondes:[line break]";
    repeat with IND running through L:
        increase C by 1;
        choose row with numero of IND in tabla;
        change activado entry to C;
        say "[C]) [seleccion entry][line break]".

To iniciar conversacion ( tabla - a table-name):
    [ Marcamos que se inicia ]
    change ConvTabla to tabla;
    quitar activados tabla;
    [ Escogemos el nodo raíz ]
    choose row with numero of 0 in tabla;
    say respuesta entry;
    say line break;
    say line break;
    nuevas opciones para 0 en tabla.


[Tabla ejemplo]
Table of Conversacion Ejemplo
numero   seleccion   respuesta   activado   activa   extra
a number   a text   a text   a number   a list of numbers   a rule
0 [inicial]   --   "'No molestes', dice."   1   {1, 2, 3}   the fake rule
1   "Tengo que molestar."   "'Pesado', contesta."   0   {3}   the fake rule
2   "Lo siento."   "'Ya, claro', dice."   0   {3, 4}   the fake rule
3   "Imbecil."   "'Te vas a cagar', dice."   0   {9999}   the fake rule
4   "En serio que lo siento."   "'No me lo creo', dice."   0   {3, 5}   the fake rule
5   "Juro que lo siento."   "'Y yo soy Napoleón', dice."   0   {3, 6}   the fake rule
6   "Por mi madre, lo siento."   "'Vale, te creo', contesta al fin."   0   {9991}   the fake rule
9991   "Gracias"   "'No hay de qué', dice."   0   --   the fake rule
9999   "Vete a la mierda"   "'Estás muerto', contesta."   0   --   the fake rule